#version 330

in vec4 osg_Vertex;
in vec3 osg_Normal;
in vec4 osg_Color;

out vec3 vD;
out vec3 vN;
out vec4 vColor;

uniform mat3 osg_NormalMatrix;
uniform mat4 osg_ModelViewMatrix;
uniform mat4 osg_ModelViewProjectionMatrix;

void main()
{
	vec4 pos = osg_Vertex;
	vColor = osg_Color;
	vN = normalize(osg_NormalMatrix*osg_Normal);
	vD = normalize(-(osg_ModelViewMatrix * pos).xyz);
	gl_Position = osg_ModelViewProjectionMatrix * pos;
}